/*
 *
 * @ProjectName:    my_umi_app
 * @Package:
 * @ClassName:      message_api
 * @Description:    留言接口
 * @Author:         SuPeiSen
 * @CreateDate:     2021/3/2 3:02 下午
 * @UpdateDate:     2021/3/2 3:02 下午
 * @UpdateRemark:   更新说明：
 * @Version:        1.0
 */

import { Requests } from '@/utils/requests';
import { ApiPath } from '@/config/api_config';
import { MessageListType } from '@/type/message_type';

/**
 * 获取留言列表
 * @param param
 * @constructor
 */
export const MessageListApi = async (param: any) => {
  return await Requests.defaults.http<MessageListType>(
    'post',
    ApiPath.getMessageList,
    {
      postData: param,
    },
  );
};

/**
 * 获取博客留言
 * @param param
 * @constructor
 */
export const MessageOnBlogListApi = async (param: any) => {
  return await Requests.defaults.http<MessageListType>(
    'post',
    ApiPath.getBlogMessageList,
    {
      postData: param,
    },
  );
};

/**
 * 审核留言
 * @param param
 * @constructor
 */
export const UpdateMessageStatusApi = async (param: {
  id: number;
  status: number;
}) => {
  return await Requests.defaults.http('put', ApiPath.updateMessageStatus, {
    postData: param,
  });
};

/**
 * 回复留言
 * @param param
 * @constructor
 */
export const AnswerMessgaeApi = async (param: any) => {
  return await Requests.defaults.http('post', ApiPath.answerMessage, {
    postData: param,
  });
};

/**
 * 删除留言
 * @constructor
 * @param id
 */
export const DeleteMessgaeApi = async (id: number) => {
  return await Requests.defaults.http('delete', ApiPath.deleteMessage, {
    getData: {
      id: id,
    },
  });
};
